import { Component, Inject, OnInit } from '@angular/core'
import { Input } from '@angular/core'

@Component({
  selector: 'app-design-mask-info',
  templateUrl: './design-mask-info.component.html',
  styleUrls: ['./design-mask-info.component.scss'],
})
export class DesignMaskInfoComponent implements OnInit {
  constructor() {
  }
    ngOnInit(): void {
    }
  @Input() info : string
  @Input() viewDesenInfo : boolean = false
  flag = false
  get showInfo(){
    if (this.flag || !this.info ||  this.info.length <= 1) {
        return this.info;
    }
    if(this.info.length<=2){
      return this.info.charAt(0) + '*'
    }
      const middleCharsCount = this.info.length - 2;
      const maskedMiddle = '*'.repeat(middleCharsCount);
      const startChars = this.info.charAt(0);
      const endChars = this.info.charAt(this.info.length - 1);
      const maskedString = startChars + maskedMiddle + endChars;
      return maskedString;
  }

}
